package com.bawei.image

/**
 * Author: Jason Zhang
 * Date: 2024/9/12
 * Desc: 图片参数配置项
 */
class ImageOptions private constructor(
    val placeImage: Int,
    val errorImage: Int,
    val isGifImage: Boolean,
    val imgSize: IntArray,
    val skipMemoryCache: Boolean,
    val skipDiskCache: Boolean,
    val isCircle: Boolean,
    val roundRadius: Int
) {

    companion object Builder {
        private var placeImage = 0
        private var errorImage = 0
        private var isGifImage = false
        private var imgSize = intArrayOf()
        private var skipMemoryCache = false
        private var skipDiskCache = false
        private var isCircle = false
        private var roundRadius = 0

        fun placeImage(placeImage: Int): Builder {
            this.placeImage = placeImage
            return this
        }

        fun errorImage(errorImage: Int): Builder{
            this.errorImage = errorImage
            return this
        }

        fun isGifImage(isGif: Boolean): Builder{
            this.isGifImage = isGif
            return this
        }

        fun imageSize(imgSize: IntArray): Builder{
            this.imgSize = imgSize
            return this
        }

        fun skipMemoryCache(skipMemoryCache: Boolean): Builder{
            this.skipMemoryCache = skipMemoryCache
            return this
        }

        fun skipDiskCache(skipDiskCache: Boolean): Builder{
            this.skipDiskCache = skipDiskCache
            return this
        }

        fun isCircle(isCircle: Boolean): Builder{
            this.isCircle = isCircle
            return this
        }

        fun roundRadius(radius: Int): Builder{
            this.roundRadius = radius
            return this
        }

        fun build(): ImageOptions{
            return ImageOptions(placeImage, errorImage, isGifImage, imgSize, skipMemoryCache, skipDiskCache, isCircle, roundRadius)
        }
    }



}